using System;
using System.Collections.Generic;

namespace LDAP.Entity
{
	/// <summary>
	///	
	/// </summary>
	[Serializable]
	public class Exceptionform : IEntity
	{
		public const string RESERVE_CONST = "exceptionform";
			
		#region Private Members
		private long _id; 
		private string _userId; 
		private string _dept; 
		private DateTime _createTime; 
		private DateTime _exceptionStartDate; 
		private DateTime _exceptionEndDate; 
		private int _type; 
		private int _durationType; 
		private float _duration; 
		private string _content; 
		private string _attachement; 
		private int _status; 
		private string _passUserId; 
		private DateTime _passTime; 
		private string _comment; 		
		[NonSerialized]
        private string _reserve;
		#endregion
		
		#region Default ( Empty ) Class Constuctor
		/// <summary>
		/// default constructor
		/// </summary>
		public Exceptionform()
		{
			_id = 0; 
			_userId = null; 
			_dept = null; 
			_createTime = new DateTime(); 
			_exceptionStartDate = new DateTime(); 
			_exceptionEndDate = new DateTime(); 
			_type = 0; 
			_durationType = 0; 
			_duration = 0; 
			_content = null; 
			_attachement = null; 
			_status = 0; 
			_passUserId = null; 
			_passTime = new DateTime(); 
			_comment = null; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor
		
		public Dictionary<string, object> ToDictionary()
		{
			Dictionary<string, object> dictionary = new Dictionary<string, object>();
		
			dictionary.Add("Id",_id);
			dictionary.Add("UserId",_userId);
			dictionary.Add("Dept",_dept);
			dictionary.Add("CreateTime",_createTime);
			dictionary.Add("ExceptionStartDate",_exceptionStartDate);
			dictionary.Add("ExceptionEndDate",_exceptionEndDate);
			dictionary.Add("Type",_type);
			dictionary.Add("DurationType",_durationType);
			dictionary.Add("Duration",_duration);
			dictionary.Add("Content",_content);
			dictionary.Add("Attachement",_attachement);
			dictionary.Add("Status",_status);
			dictionary.Add("PassUserId",_passUserId);
			dictionary.Add("PassTime",_passTime);
			dictionary.Add("Comment",_comment);
			
			dictionary.Add("Reserve",Reserve);//特殊
			return dictionary;
		}
		
		#region Public Properties
		/// <summary>
		/// 
		/// </summary>		
		public long Id
		{
			get { return _id; }
			set { _id = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string UserId
		{
			get { return _userId; }
			set	
			{
				if( value!= null && value.Length > 10)
					throw new ArgumentOutOfRangeException(@"Invalid value for UserId", value, value);
				
				_userId = value;
			}
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string Dept
		{
			get { return _dept; }
			set	
			{
				if( value!= null && value.Length > 100)
					throw new ArgumentOutOfRangeException(@"Invalid value for Dept", value, value);
				
				_dept = value;
			}
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public DateTime CreateTime
		{
			get { return _createTime; }
			set { _createTime = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public DateTime ExceptionStartDate
		{
			get { return _exceptionStartDate; }
			set { _exceptionStartDate = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public DateTime ExceptionEndDate
		{
			get { return _exceptionEndDate; }
			set { _exceptionEndDate = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public int Type
		{
			get { return _type; }
			set { _type = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public int DurationType
		{
			get { return _durationType; }
			set { _durationType = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public float Duration
		{
			get { return _duration; }
			set { _duration = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string Content
		{
			get { return _content; }
			set	
			{
				if( value!= null && value.Length > 2000)
					throw new ArgumentOutOfRangeException(@"Invalid value for Content", value, value);
				
				_content = value;
			}
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string Attachement
		{
			get { return _attachement; }
			set	
			{
				if( value!= null && value.Length > 1000)
					throw new ArgumentOutOfRangeException(@"Invalid value for Attachement", value, value);
				
				_attachement = value;
			}
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public int Status
		{
			get { return _status; }
			set { _status = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string PassUserId
		{
			get { return _passUserId; }
			set	
			{
				if( value!= null && value.Length > 10)
					throw new ArgumentOutOfRangeException(@"Invalid value for PassUserId", value, value);
				
				_passUserId = value;
			}
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public DateTime PassTime
		{
			get { return _passTime; }
			set { _passTime = value; }
		}
			
		/// <summary>
		/// 
		/// </summary>		
		public string Comment
		{
			get { return _comment; }
			set	
			{
				if( value!= null && value.Length > 200)
					throw new ArgumentOutOfRangeException(@"Invalid value for Comment", value, value);
				
				_comment = value;
			}
		}
			
		/// <summary>
        /// 保留属性
        /// </summary>
        public string Reserve
        {
            get 
            {
                if (string.IsNullOrEmpty(_reserve))
                    return RESERVE_CONST  ;

                return _reserve; 
            }
            set { _reserve = value; }
        }
		#endregion 
	}
}
